home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / Z80 emulator / 68K version / z80.macros < prev    next >
Encoding:
Text File  |  1995-11-01  |  3.4 KB  |  144 lines  |  [TEXT/CWIE]

  1.  
  2. #undef    EXACT_R            // ••• must be revised
  3. #define    EXACT_R        0
  4.  
  5. #undef    INFO_ILLEGALS        // ••• must be revised
  6. #define    INFO_ILLEGALS    0
  7.  
  8. #undef    INFO_WEIRD        // ••• must be revised
  9. #define    INFO_WEIRD    0
  10.  
  11. #undef    INFO_IRPT            // ••• must be revised
  12. #define    INFO_IRPT     0
  13.  
  14. #undef    INFO_NMI            // ••• must be revised
  15. #define    INFO_NMI        0
  16.  
  17. #undef    INFO_MISC        // ••• must be revised
  18. #define    INFO_MISC    0
  19.  
  20. #undef    CMD_PROFILE        // ••• must be revised
  21. #define    CMD_PROFILE    0
  22.  
  23. #undef    PC_PROFILE        // ••• must be revised
  24. #define    PC_PROFILE    0
  25.  
  26.  
  27. //    code generating macros for Z80()  (68k assembly version)
  28. //    -----------------------------------------------------
  29.  
  30. #define    m_next    jmp    (loop)
  31.  
  32.  
  33. // -----    Macros which call Z80_Info(cc,ip) or do nothing ------------------------------------
  34. //        depending on flags defined in z80.options
  35.  
  36. #if INFO_IRPT
  37. #define    do_info_irpt    }; Z80_Info_Irpt (cc,ip); asm {    
  38. #else
  39. #define    do_info_irpt    
  40. #endif
  41.  
  42. #if INFO_NMI
  43. #define    do_info_nmi    }; Z80_Info_NMI (cc,ip); asm {
  44. #else
  45. #define    do_info_nmi    
  46. #endif
  47.  
  48. #if INFO_ILLEGALS
  49. #define    do_info_illegals1    }; Z80_Info(cc,ip-1); asm { 
  50. #define    do_info_illegals2    }; Z80_Info(cc,ip-2); asm { 
  51. #define    do_info_illegals3    }; Z80_Info(cc,ip-3); asm { 
  52. #define    do_info_illegals4    }; Z80_Info(cc,ip-4); asm { 
  53. #else
  54. #define    do_info_illegals1
  55. #define    do_info_illegals2
  56. #define    do_info_illegals3
  57. #define    do_info_illegals4
  58. #endif
  59.  
  60. #if INFO_MISC
  61. #define    do_info_rst0        }; Z80_Info ( cc,ip-1 ); asm {
  62. #define    do_info_rst8        }; Z80_Info ( cc,ip-1 ); asm {
  63. #define    do_info_rst16        }; Z80_Info ( cc,ip-1 ); asm {
  64. #define    do_info_rst24        }; Z80_Info ( cc,ip-1 ); asm {
  65. #define    do_info_rst32        }; Z80_Info ( cc,ip-1 ); asm {
  66. #define    do_info_rst40        }; Z80_Info ( cc,ip-1 ); asm {
  67. #define    do_info_rst48        }; Z80_Info ( cc,ip-1 ); asm {
  68. #define    do_info_rst56        }; Z80_Info ( cc,ip-1 ); asm {
  69. #else
  70. #define    do_info_rst0        
  71. #define    do_info_rst8        
  72. #define    do_info_rst16        
  73. #define    do_info_rst24        
  74. #define    do_info_rst32        
  75. #define    do_info_rst40        
  76. #define    do_info_rst48        
  77. #define    do_info_rst56        
  78. #endif
  79.  
  80. #if INFO_MISC
  81. #define    do_info_di            }; Z80_Info ( cc,ip-1 ); asm {
  82. #define    do_info_ei            }; Z80_Info ( cc,ip-1 ); asm {
  83. #define    do_info_halt        }; Z80_Info ( cc,ip-1 ); asm {
  84. #define    do_info_r            }; Z80_Info ( cc,ip-2 ); asm {
  85. #define    do_info_i            }; Z80_Info ( cc,ip-2 ); asm {
  86. #define    do_info_im        }; Z80_Info ( cc,ip-2 ); asm {
  87. #define    do_info_retn        }; Z80_Info ( cc,ip-2 ); asm {
  88. #define    do_info_reti        }; Z80_Info ( cc,ip-2 ); asm {
  89. #define    do_info_daa        }; Z80_Info ( cc,ip-1 ); asm {
  90. #else
  91. #define    do_info_di        
  92. #define    do_info_ei    
  93. #define    do_info_halt
  94. #define    do_info_r
  95. #define    do_info_i
  96. #define    do_info_im
  97. #define    do_info_retn
  98. #define    do_info_reti
  99. #define    do_info_daa
  100. #endif
  101.  
  102.  
  103. // -----    Exact register R handling:  R is kept in mc68 register
  104. #if EXACT_R    
  105.  
  106. #define    define_r    register short r;
  107.  
  108. #define    load_r    move.b    RR,r    ;\
  109.                 add.w    r,r        ;\
  110.                 lsr.b        #1,r
  111.  
  112. #define    store_r    add.b        r,r        ;\
  113.                 lsr.w    #1,r        ;\
  114.                 move.b    r,RR
  115.                 
  116. #define    ld_r_a    move.w    a,r        ;\
  117.                 add.w    r,r        ;\
  118.                 lsr.b        #1,r
  119.  
  120. #define    ld_a_r    add.b        r,r        ;\
  121.                 lsr.w    #1,r        ;\
  122.                 move.b    r,a        // and set flags Z and S !!!
  123.  
  124.  
  125. // -----    Use register R for random generation only: Bit 7 is kept in RR
  126. #else
  127.  
  128. #define    define_r    // nop
  129. #define    load_r    // nop
  130. #define    store_r    // nop
  131.  
  132. #define    ld_r_a    move.b    a,RR
  133.  
  134. #define    ld_a_r    move.b    RR,a    ;\
  135.                 and.b     #0x80,a    ;\
  136.                 subq.l    #2,a7    ;\
  137.                 _Random            ;\
  138.                 move.w    (a7)+,d0    ;\
  139.                 and.b     #0x7f,d0    ;\
  140.                 or.b        d0,a        // and set flags Z and S !!!
  141.  
  142. #endif
  143.  
  144.